--[[
 -- *名称:EnterRoomPart
 -- *描述:输入房间号界面
 -- *版权:Copyright © 2016-2018 深圳市三只小熊科技有限公司 版权所有
 -- *作者:Administrator
 -- *创建日期:2017-11-06
 -- *修改日期:2017-11-06
 ]]
local CURRENT_MODULE_NAME = ...
local EnterRoomPart = class("EnterRoomPart", PokerPartBase) --登录模块
EnterRoomPart.DEFAULT_PART = {}
EnterRoomPart.DEFAULT_VIEW = "enterroomlayer"
--[
-- @brief 构造函数
--]
function EnterRoomPart:ctor(owner)
    EnterRoomPart.super.ctor(self, owner)
    self:initialize()
end

--[
-- @override
--]
function EnterRoomPart:initialize()
	self.num_list = {}
	cc.bind(self, "roomlogic");
end
---
 -- 激活模块
 -- @DateTime 2017-11-06
 -- @param    data [description]
 -- @return    [description]
 --
function EnterRoomPart:activate(data)
	EnterRoomPart.super.activate(self, CURRENT_MODULE_NAME)
	self.num_list = {}
end

function EnterRoomPart:deactivate()
	EnterRoomPart.super.deactivate(self);
	if self.view then
		self.view:removeSelf()
		self.view = nil
		self.num_list = {}
	end
end

function EnterRoomPart:getPartId()
	return "EnterRoomPart"
end

function EnterRoomPart:appendNumber(num)
	if #self.num_list < 6 then
		table.insert(self.num_list,num)
		self:doView("showNum", self.num_list);
	end
end

function EnterRoomPart:requestEnterRoomClick()
	local roomId = tonumber(table.concat(self.num_list));
	self:requestEnterRoom(DdzGameConfig.GAME_ID, roomId);
end

function EnterRoomPart:deleteNumber()
	if #self.num_list > 0 then
		table.remove(self.num_list)
		self:doView("showNum", self.num_list)
	end
end

function EnterRoomPart:clearRoomId( ... )
	self.num_list = {}
	self:doView("showNum", self.num_list)
end

function EnterRoomPart:createGameClick()
	self.owner:createRoom()
end

return EnterRoomPart 